<?php $this->load->view('index/header.html'); ?>

		<!-- Main -->
			<div id="main">
				
					<?php foreach($article as $item):?>
					<section>
						<header class="major">
							<h2><a href="<?php echo site_url('home/article/'); ?><?=$item->id?>"><?=$item->title?></a></h2>
						</header>
						<p><?=$item->description?></p>
					</section>
					<?php endforeach;?>
				
					<ul class="actions">
							<li><a href="" class="button" ajax-data="<?php echo site_url('home/postart');?>" url="<?php echo site_url('home/article/');?>">加载更多</a></li>
						</ul>

			</div>
			
<?php $this->load->view('index/footer.html'); ?>
<script type="text/javascript">
<!--
	var id = 1;
	var posturl = $(".button").attr("ajax-data");
	var url = $(".button").attr("url");
	var text ="";
	$(".actions").click(function(){
		$.post(posturl,{"num":id},function(data){
			if(data.length>2){
				data = eval('('+data+')');
				$.each(data,function(i,item){
					text ="<section><header class='major'><h2><a href='"+url+item.id+"'>"+item.title+"</a></h2></header><p>"+item.description+"</p></section>";
					$("section:last").after(text);
				}); 
			}else{
				alert("已没有文章了");
			}
		});
		id++;
		return false;
	});
//-->
</script>